<div class="yui-g">
    <table id="editgrid"></table>
    <div id="pager"></div>
</div>
<script type="text/javascript">
    var lastsel3;
    jQuery(document).ready(function(){
        jQuery("#editgrid").jqGrid({
            url:'<?=base_url();?>index.php/admin/modulos/post',
            datatype: 'json',
            mtype: 'POST',
            colNames:['id','Nombre','Texto del menu','Empresa','Activo','Visible en menu'],
            colModel :[
                {name:'id', index:'id', width:90,editable:false,editoptions:{size:10}},
                {name:'nombre', index:'nombre', width:300,editable:true,editoptions:{size:40}},
                {name:'texto_menu', index:'texto_menu', width:120,editable:true,editoptions:{size:20}},
                {name:'empresa', index:'empresa', width:120,editable:true,editoptions:{size:20}},
                {name:'estado',index:'estado', width:90, editable: true,edittype:"checkbox",editoptions: {value:"si:no"}},
                {name:'visible',index:'visible', width:90, editable: true,edittype:"checkbox",editoptions: {value:"si:no"}},
            ],
            pager: '#pager',
            rowNum:20,
            rowList:[10,20,30],
            sortname: 'nombre',
            sortorder: 'desc',
            viewrecords: true,
            caption: 'Modulos',
            height:'100%',
            width:'100%',
            onSelectRow: function(id){
                    jQuery('#editgrid').jqGrid('restoreRow',lastsel3);
                    jQuery('#editgrid').jqGrid('editRow',id,true);
                    lastsel3=id;
            },
            editurl:"<?=base_url();?>index.php/admin/modulos/guardar"
        });
        jQuery("#editgrid").jqGrid('navGrid',"#pager",{edit:false,add:true,del:true});
    });
</script>
